package com.cxhc.app.api;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.cxhc.system.domain.app.FlowFormFireFirecheck;
import com.cxhc.system.service.app.IFlowFormFireFirecheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.AjaxResult;
import com.cxhc.common.utils.poi.ExcelUtil;
import com.cxhc.common.core.page.TableDataInfo;

/**
 * 消防队消防检查Controller
 *
 * @author Dhq
 * @date 2024-09-23
 */
@RestController
@RequestMapping("/api/fireCheck")
public class ApiFlowFormFireFirecheck extends BaseController
{
    @Autowired
    private IFlowFormFireFirecheckService flowFormFireFirecheckService;

    /**
     * 查询消防队消防检查列表
     */
    @GetMapping("/list")
    public TableDataInfo list(FlowFormFireFirecheck flowFormFireFirecheck)
    {
        startPage();
        List<FlowFormFireFirecheck> list = flowFormFireFirecheckService.selectFlowFormFireFirecheckList(flowFormFireFirecheck);
        return getDataTable(list);
    }

    /**
     * 导出消防队消防检查列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, FlowFormFireFirecheck flowFormFireFirecheck)
    {
        List<FlowFormFireFirecheck> list = flowFormFireFirecheckService.selectFlowFormFireFirecheckList(flowFormFireFirecheck);
        ExcelUtil<FlowFormFireFirecheck> util = new ExcelUtil<FlowFormFireFirecheck>(FlowFormFireFirecheck.class);
        util.exportExcel(response, list, "消防队消防检查数据");
    }

    /**
     * 获取消防队消防检查详细信息
     */
    @GetMapping(value = "/detail/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(flowFormFireFirecheckService.selectFlowFormFireFirecheckById(id));
    }

    /**
     * 新增消防队消防检查
     */
    @PostMapping("/insert")
    public AjaxResult add(@RequestBody FlowFormFireFirecheck flowFormFireFirecheck)
    {
        return toAjax(flowFormFireFirecheckService.insertFlowFormFireFirecheck(flowFormFireFirecheck));
    }

    /**
     * 修改消防队消防检查
     */
    @PostMapping("/update")
    public AjaxResult edit(@RequestBody FlowFormFireFirecheck flowFormFireFirecheck)
    {
        return toAjax(flowFormFireFirecheckService.updateFlowFormFireFirecheck(flowFormFireFirecheck));
    }

    /**
     * 删除消防队消防检查
     */

    @GetMapping(value = "/delete/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(flowFormFireFirecheckService.deleteFlowFormFireFirecheckById(id));
    }
}
